package top.college.service;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Scanner;

import javax.swing.JTextField;

import top.college.dao.JDBC_ConnClose;
import top.college.dao.JDBC_SQL;
import top.college.screen.LoginMain;

public class AdminDelete {
	
	public static boolean deleteAdmin(JTextField AdminID) {
		Connection conn = null;
		PreparedStatement pstmt = null;
		ResultSet rs = null;
		
		try {
			conn = JDBC_ConnClose.openDataBase();
			pstmt = conn.prepareStatement(JDBC_SQL.AdminDeleteSQL);
			pstmt.setString( 1, AdminID.getText() );
			pstmt.executeUpdate();
			return true;
		} catch ( Exception e ) {
			e.printStackTrace();
		} finally {
			JDBC_ConnClose.closeDataBase(conn, pstmt, rs);
		}
		return false;
	}
}